package com.qdlc.p2p.dal.dao.impl;

import javax.persistence.Query;

import org.springframework.stereotype.Service;

import com.qdlc.p2p.common.constant.Global;
import com.qdlc.p2p.dal.common.dao.jpa.BaseDaoImpl;
import com.qdlc.p2p.dal.dao.EnjoyUserDao;
import com.qdlc.p2p.dal.dto.EnjoyUser;

/**
 * Created by D on 2016/1/21.
 */
@Service("enjoyUserDao")
public class EnjoyUserDaoImpl extends BaseDaoImpl<EnjoyUser> implements EnjoyUserDao {

    @Override
    public void updateStatus(long id, int status, int preStatus) {
        String jpql = "update " + Global.DB_PREFIX + "additional_enjoy_user set `status` = " + status
                + " where `status` = " + preStatus + " and enjoy_borrow_id ="+ id;
        Query query = em.createNativeQuery(jpql);
        query.executeUpdate();
    }
}
